.TH std::ranges::split_view::iterator 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::ranges::split_view::iterator \- std::ranges::split_view::iterator

.SH Synopsis
   class /*iterator*/;  \fI(since C++20)\fP
                        (exposition only*)

   The return type of split_view::begin. This is a forward_iterator, so it is expected
   that V models at least forward_range.

.SH Member types

   Member type       Definition
   iterator_concept  std::forward_iterator_tag
   iterator_category std::input_iterator_tag
   value_type        ranges::subrange<ranges::iterator_t<V>>
   difference_type   ranges::range_difference_t<V>

   Data members

   Member name               Definition
                             A pointer of type ranges::split_view<V, Pattern>* to the
   parent_ (private)         parent split_view object.
                             (exposition-only member object*)
                             An iterator of type ranges::iterator_t<V> into the
   cur_ (private)            underlying view that points to the begin of a current
                             subrange.
                             (exposition-only member object*)
                             A subrange of type ranges::subrange<ranges::iterator_t<V>>
   next_ (private)           to the position of the pattern next to the current
                             subrange.
                             (exposition-only member object*)
                             A boolean flag that indicates whether an empty trailing
   trailing_empty_ (private) subrange (if any) was reached.
                             (exposition-only member object*)

.SH Member functions

   constructor     constructs an iterator
   (C++20)         \fI(public member function)\fP
   base            returns the underlying iterator
   (C++20)         \fI(public member function)\fP
   operator*       returns the current subrange
   (C++20)         \fI(public member function)\fP
   operator++      advances the iterator
   operator++(int) \fI(public member function)\fP
   (C++20)

std::ranges::split_view::iterator::iterator

   /*iterator*/() = default;                                          \fB(1)\fP \fI(since C++20)\fP
   constexpr /*iterator*/( split_view& parent, ranges::iterator_t<V>
   current,                                                           \fB(2)\fP \fI(since C++20)\fP
                           ranges::subrange<ranges::iterator_t<V>>
   next );

   1) Value-initializes non-static data members with their default member initializers,
   that is
     * ranges::split_view* parent_ = nullptr;,
     * ranges::iterator_t<V> cur_ = ranges::iterator_t<V>();,
     * ranges::subrange<ranges::iterator_t<V>> next_ =
       ranges::subrange<ranges::iterator_t<V>>();, and
     * bool trailing_empty_ = false;.
   2) Initializes non-static data members:
     * ranges::split_view* parent_ = std::addressof(parent);,
     * ranges::iterator_t<V> cur_ = std::move(current);,
     * ranges::subrange<ranges::iterator_t<V>> next_ = std::move(next);, and
     * bool trailing_empty_ = false;.

std::ranges::split_view::iterator::base

   constexpr const ranges::iterator_t<V> base() const;  \fI(since C++20)\fP

   Equivalent to return cur_;.

std::ranges::split_view::iterator::operator*

   constexpr ranges::range_reference_t<V> operator*() const;  \fI(since C++20)\fP

   Equivalent to return {cur_, next_.begin()};.

std::ranges::split_view::iterator::operator++

   constexpr /*iterator*/& operator++(); \fB(1)\fP \fI(since C++20)\fP
   constexpr void operator++( int );     \fB(2)\fP \fI(since C++20)\fP

   1) Equivalent to
   cur_ = next_.begin();

   if (cur_ != ranges::end(parent_->base_))
   {
       if (cur_ = next_.end(); cur_ == ranges::end(parent_->base_))
       {
           trailing_empty_ = true;
           next_ = {cur_, cur_};
       }
       else
           next_ = parent_->find_next(cur_);
   }
   else
       trailing_empty_ = false;

   return *this;
   2) Equivalent to auto tmp = *this; ++*this; return tmp;.

.SH Non-member functions

   operator== compares the underlying iterators
   (C++20)    \fI(function)\fP

operator==(std::ranges::split_view::iterator, std::ranges::split_view::iterator)

   friend constexpr bool operator==( const /*iterator*/& x, const         \fI(since C++20)\fP
   /*iterator*/& y );

   Equivalent to return x.cur_ == y.cur_ and x.trailing_empty_ == y.trailing_empty_;.

   The != operator is synthesized from operator==.

   This function is not visible to ordinary unqualified or qualified lookup, and can
   only be found by argument-dependent lookup when std::ranges::split_view::iterator is
   an associated class of the arguments.
